<template>
  <div class="box">
    <h1>新品首发</h1>
    <div v-for="(item, index) in data" :key="index" class="box1" @click="goAbout(item.id)">
      <div class="box2">
        <img :src="item.list_pic_url" alt="" />
      </div>
      <h2>
        {{ item.name }}
      </h2>
      <h3>
        {{ item.retail_price | RMBformat }}
      </h3>
    </div>
  </div>
</template>

<script>
import {  mapMutations } from "vuex";
export default {
  name: "newList",
  props: ["data"],
  methods:{
    goAbout(value){
      this.chanGe()
      this.$router.push({name:"About",params:{id:value,onoff:true}})
    },
    ...mapMutations(["chanGe"])
  }
};
</script>

<style scoped lang="less">
.box {
    margin-top: 50px;
  height: 500px;
  h1 {
    font-size: 20px;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
  }
  .box1 {
    width: 50%;
    height: 200px;
    // background: brown;
    float: left;
    position: relative;
    .box2 {
      height: 174px;
      width: 174px;
      position: absolute;
      left:50%;
      transform: translateX(-50%);
      img {
        width: 100%;
        height: 100%;
      }
    }
    h2{
        position: absolute;
        bottom: 25px;
        left:50%;
        transform: translateX(-50%);
        display: block;
        width: 100%;
        text-align: center;
        font-size: 14px;
    }
    h3{
        position: absolute;
        bottom: 0px;
        left:50%;
        transform: translateX(-50%);
        display: block;
        width: 100%;
        text-align: center;
        font-size: 16px;
        color: darkred;
    }
  }
}
</style>